<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div></div>
    
    <script>
        console.log(location.search)    //输出: ?uname=winter
        //先去掉 ? 用 substr(起始的位置索引,截取几个字符(不填默认截取到最后)) 截取字符串
        var params = location.search.substr(1)  //uname=winter
        console.log(params);
        //再利用等号分割 键 和 值  split('=')
        var arr = params.split('=')
        console.log(arr);

        var div = document.querySelector('div')
        div.innerHTML = arr[1]+'欢迎光临'

    </script>
</body>
</html>